import config from "@/config"
import http from "@/utils/request"

import sysmenu from '@/mock/menu-mock'

/**
 * 系统管理
 * @version 1.0
 */
export default {
	menu: {
		myMenus: {
			url: `${config.API_URL}/system/menu/my/1.6.1`,
			name: "获取我的菜单",
			get: async function () {
				return sysmenu; // await http.get(this.url);
			},
		},
		list: {
			url: `${config.API_URL}/system/menu/list`,
			name: "获取菜单",
			get: async function () {
				return await http.get(this.url);
			},
		},
	},
	dic: {
		tree: {
			url: `${config.API_URL}/system/dic/tree`,
			name: "获取字典树",
			get: async function () {
				return await http.get(this.url);
			},
		},
		list: {
			url: `${config.API_URL}/system/dic/list`,
			name: "字典明细",
			get: async function (params) {
				return await http.get(this.url, params);
			},
		},
		get: {
			url: `${config.API_URL}/system/dic/get`,
			name: "获取字典数据",
			get: async function (params) {
				return await http.get(this.url, params);
			},
		},
	},
	role: {
		list: {
			url: `${config.API_URL}/api/admin/system/role`,
			name: "角色列表",
			get: async function (params) {
				return await http.get(this.url, params);
			},
		},
	},
	user: {
		list: {
			url: `${config.API_HOST}/api/admin/system/user`,
			name: "用户列表",
			get: async function (params) {
				return await http.get(this.url, params);
			},
		},
		create: {
			url: `${config.API_HOST}/api/admin/user/create`,
			name: "创建新用户",
			post: async function (data) {
				return await http.post(this.url, data);
			},
		},
	},
	app: {
		list: {
			url: `${config.API_URL}/system/app/list`,
			name: "应用列表",
			get: async function () {
				return await http.get(this.url);
			},
		},
	},
	log: {
		list: {
			url: `${config.API_URL}/system/log/list`,
			name: "日志列表",
			get: async function (params) {
				return await http.get(this.url, params);
			},
		},
	},
	table: {
		list: {
			url: `${config.API_URL}/system/table/list`,
			name: "表格列管理列表",
			get: async function (params) {
				return await http.get(this.url, params);
			},
		},
		info: {
			url: `${config.API_URL}/system/table/info`,
			name: "表格列管理详情",
			get: async function (params) {
				return await http.get(this.url, params);
			},
		},
	},
	tasks: {
		list: {
			url: `${config.API_URL}/system/tasks/list`,
			name: "系统任务管理",
			get: async function (params) {
				return await http.get(this.url, params);
			},
		},
	},
	// 系统配置项
	configure: {
		list: {
			url: `${config.API_URL}/api/admin/system/configuration`,
			name: "系统配置列表",
			get: async function (params) {
				return await http.get(this.url, params);
			},
		},
		update: {
			url: `${config.API_URL}/api/admin/system/configuration/:id`,
			name: "系统配置更新",
			put: async function (id, data) {
				return await http.put(this.url.replace(':id', id), data);
			},
		}
	},

	// 行政区划
	region: {
		list: {
			url: `${config.API_URL}/api/admin/system/region`,
			name: "行政区划列表",
			get: async function () {
				return await http.get(this.url);
			},
		},
	},
};
